package com.woniu.mqwork;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class ItemConsumer {
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "queue-service"),
            exchange = @Exchange(name = "exchange-service",type = ExchangeTypes.DIRECT),
            key = "service"
    ))
    public void handlerMessage(String msg) {
        System.out.println("服务表id："+msg);
    }
}
